package com.sskj.award.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.award.bean.PlatformDataBean;
import com.sskj.award.bean.WelfareDistrictBean;
import com.sskj.award.ui.activity.WelfareDistrictActivity;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.MD5Util;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.lib.util.CommonUtil;

public class WelfareDistrictPrestener extends BasePresenter<WelfareDistrictActivity> {
    /**福利取首页
     * @return
     */
    public void getDistrictData() {
        httpService.getDistrictData()
                .tag(this)
                .execute(new JsonCallBack<HttpData<WelfareDistrictBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<WelfareDistrictBean>> response) {
                        mView.getDistrictDataSuccess(response.body().getData());
                    }
                });
    }

    public void onCreateParticipate(String code, String payment_password, String money, String type) {
        httpService.onCreateParticipate(code, CommonUtil.getFiveMd5Value(payment_password),money,type)
                .tag(this)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        mView.onCreateParticipateSuccess();
                    }
                });
    }

    public void upDataSuperUser(String payment_password) {
        httpService.upDataSuperUser(CommonUtil.getFiveMd5Value(payment_password))
                .tag(this)
                .execute(new JsonCallBack<HttpData<PlatformDataBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<PlatformDataBean>> response) {
                        mView.upDataSuperUserSuccess();
                    }
                });
    }
}
